package co.baiku.boot.core.orm.dto;

import co.baiku.boot.core.orm.po.Po;
import org.springframework.security.core.GrantedAuthority;

public class AuthDetailDto extends Po<Long> implements GrantedAuthority {
    private String authority;

    public AuthDetailDto() {

    }

    public AuthDetailDto(String authority) {
        this.authority = authority;
    }

    public void setAuthority(String authority) {
        this.authority = authority;
    }

    @Override
    public String getAuthority() {
        return authority;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof GrantedAuthority) {
            return authority.equals(((GrantedAuthority) obj).getAuthority());
        }
        return false;
    }

    @Override
    public int hashCode() {
        return this.authority.hashCode();
    }

    @Override
    public String toString() {
        return this.authority;
    }

}
